<?php
/**
 * day.php
 *
 * @author Martin Ludvik <matolud@gmail.com>
 * @copyright Copyright &copy; 2013 by Martin Ludvik
 * @license http://opensource.org/licenses/MIT MIT license
 */
?>
<thead>
  <tr class="month-year-row">
    <th class="previous">
      <?php echo CHtml::link('<', $previousUrl, array('class' => 'navigation-link')); ?>
    </th>
    <th class="month-year">
      <?php	
		$monthHeader= Yii::t('ecalendarview', $dataProvider->getPagination()->getMiddleRelevantPageDate()->format('F')); 
	  
		//Translate month name to Spanish name
		switch($monthHeader){
			case "January":
				echo "Enero";
				break;
			case "February":
				echo "Febrero";
				break;
			case "March":
				echo "Marzo";
				break;
			case "April":
				echo "Abril";
				break;
			case "May":
				echo "Mayo";
				break;
			case "June":
				echo "Junio";
				break;
			case "July":
				echo "Julio";					
				break;
			case "August":
				echo "Agosto";					
				break;
			case "September":
				echo "Septiembre";					
				break;
			case "October":
				echo "Octubre";					
				break;
			case "November":
				echo "Noviembre";					
				break;
			case "December":
				echo "Diciembre";					
				break;
		}	  
	  ?>,
      <?php echo $dataProvider->getPagination()->getMiddleRelevantPageDate()->format('Y'); ?>
    </th>
    <th class="next">
      <?php echo CHtml::link('>', $nextUrl, array('class' => 'navigation-link')); ?>
    </th>
  </tr>
  <tr class="weekdays-row">
    <th class="<?php echo strtolower($dataProvider->getPagination()->getFirstPageDate()->format('D')); ?>" colspan="3">
      <?php 
	  
		$dayHeader=  Yii::t('ecalendarview', $dataProvider->getPagination()->getFirstPageDate()->format('D')); 
	  
		//Translate day name abbreviation to Spanish abbreviation
		switch($dayHeader){
			case "Mon":
				echo "Lunes";
				break;
			case "Tue":
				echo "Martes";
				break;
			case "Wed":
				echo "Miércoles";
				break;
			case "Thu":
				echo "Jueves";
				break;
			case "Fri":
				echo "Viernes";
				break;
			case "Sat":
				echo "Sábado";
				break;
			case "Sun":
				echo "Domingo";					
				break;
		}		  
	  ?>
    </th>
  </tr>
</thead>

<tbody class="dayCalendarTable">
  <?php $data = $dataProvider->getData(); ?>
  <tr>
    <?php
      $classes = array();
		
	/*
      if($data[0]->isCurrentDate) {
        $classes[] = 'currentday';
      } else {
        $classes[] = 'currentday';
      }
	*/
	
      if($data[0]->isRelevantDate) {
        $classes[] = 'relevant';
      } else {
        $classes[] = 'not-relevant';
      }

      $classes[] = strtolower($data[0]->date->format('D'));

      $classesStr = implode(' ', $classes);
    ?>
    <td class="<?php echo $classesStr; ?>" colspan="3">
      <?php $this->getOwner()->renderFile($itemViewFile, array(
        'data' => $data[0],
		'id'=>$idCliente,
      )); ?>
    </td>
  </tr>
</tbody>
